package com.yricky.atri.model.pojo

import org.tensorflow.lite.DataType

/**
 * @author Yricky
 * @date 2021/12/8
 */
data class ModelMetaData(
    val name:String,
    val input:ArrayList<TensorMetaData>,
    val output:ArrayList<TensorMetaData>
)

data class TensorMetaData(
    val name:String,
    val dataType: DataType,
    val numDimensions: Int,
    val shape:IntArray,
    val numBytes: Int,
    val numElements:Int
) {
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as TensorMetaData

        if (name != other.name) return false
        if (dataType != other.dataType) return false
        if (numDimensions != other.numDimensions) return false
        if (!shape.contentEquals(other.shape)) return false
        if (numBytes != other.numBytes) return false
        if (numElements != other.numElements) return false

        return true
    }

    override fun hashCode(): Int {
        var result = name.hashCode()
        result = 31 * result + dataType.hashCode()
        result = 31 * result + numDimensions
        result = 31 * result + shape.contentHashCode()
        result = 31 * result + numBytes
        result = 31 * result + numElements
        return result
    }
}